//
//  EMRepaymentHeaderView.m
//  EasyMoney
//
//  Created by zh on 2020/1/11.
//  Copyright © 2020 zh. All rights reserved.
//

#import "EMRepaymentHeaderView.h"

@interface EMRepaymentHeaderView ()

@property (nonatomic, strong) UILabel *countLabel; //金额

@end

@implementation EMRepaymentHeaderView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self setupUI];
    }
    return self;
}

- (void)setupUI{

    self.backgroundColor = [UIColor whiteColor];
    UILabel *titleLabel = [[UILabel alloc]init];
    titleLabel.text = NSLocalizedString(@"还款金额", nil);
    titleLabel.font = FONT_PINGFANG_REGULAR_(14);
    titleLabel.textColor = ColorFromRGB(0x333333);
    [self addSubview:titleLabel];
    [titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self);
        make.top.mas_equalTo(30);
    }];

    //上线金额view
    UIView *repayMoneyView = [[UIView alloc]init];
    [self addSubview:repayMoneyView];
    [repayMoneyView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self);
        make.top.equalTo(titleLabel.mas_bottom).offset(10);
    }];
    UILabel *unitLabel = [[UILabel alloc]init];
    unitLabel.text = NSLocalizedString(@"¥", nil);
    unitLabel.textColor = ColorFromRGB(0x333333);
    unitLabel.font = FONT_PINGFANG_MEDIUM_(24);
    [repayMoneyView addSubview:unitLabel];
    [unitLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(repayMoneyView);
        make.centerY.equalTo(repayMoneyView);
    }];

    self.countLabel = [[UILabel alloc]init];
    self.countLabel.textColor = ColorFromRGB(0x333333);
    self.countLabel.font = FONT_PINGFANG_MEDIUM_(36);
    [repayMoneyView addSubview:self.countLabel];
    [self.countLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(unitLabel.mas_right).offset(5);
        make.centerY.equalTo(repayMoneyView);
        make.right.equalTo(repayMoneyView.mas_right);
        make.height.equalTo(repayMoneyView);
    }];
    
}

- (void)setRepayMoney:(NSString *)repayMoney{
    _repayMoney = repayMoney;
    self.countLabel.text = repayMoney;
}
@end
